//
//  ProfessorTableViewCell.m
//  beautifulHome
//
//  Created by lanou on 15/12/17.
//  Copyright © 2015年 lanou. All rights reserved.
//

#import "ProfessorTableViewCell.h"
#import "ProfessorModel.h"
#import "UIImageView+AFNetworking.h"

#define kWidth [UIScreen mainScreen].bounds.size.width
#define kWidth1 (kWidth-5*5-10*2)/4
@implementation ProfessorTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.backgroundColor = [UIColor clearColor];
        
        _imageView0 = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, kWidth - 20, 200)];
        _imageView0.backgroundColor = [UIColor whiteColor];
        [self.contentView addSubview:_imageView0];
        
        _pictureView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 60, 60)];
        [_imageView0 addSubview:_pictureView];
        
        _pictureView1 = [[UIImageView alloc] initWithFrame:CGRectMake(5, 80, kWidth1, kWidth1)];
        [_imageView0 addSubview:_pictureView1];
        
        _pictureView2 = [[UIImageView alloc] initWithFrame:CGRectMake(kWidth1 + 10, 80, kWidth1, kWidth1)];
        [_imageView0 addSubview:_pictureView2];
        
        _pictureView3 = [[UIImageView alloc] initWithFrame:CGRectMake(kWidth1*2 + 15, 80, kWidth1, kWidth1)];
        [_imageView0 addSubview:_pictureView3];
        
        _pictureView4 = [[UIImageView alloc] initWithFrame:CGRectMake(kWidth1*3 + 20, 80, kWidth1, kWidth1)];
        [_imageView0 addSubview:_pictureView4];
        
        _nameLabel = [[UILabel alloc] initWithFrame:(CGRectMake(80, 20, 100, 10))];
        [_imageView0 addSubview:_nameLabel];
        
        _locationLabel = [[UILabel alloc] initWithFrame:CGRectMake(80, 50, 120, 10)];
        [_imageView0 addSubview:_locationLabel];
        
        _priceLabel = [[UILabel alloc] initWithFrame:(CGRectMake(220, 30, 130, 30))];
      
        [_imageView0 addSubview:_priceLabel];
        
        _contactedLabel = [[UILabel alloc] initWithFrame:(CGRectMake(210, kWidth1 + 95, 80, 10))];
        [_imageView0 addSubview:_contactedLabel];
        
        _verifiedLabel = [[UILabel alloc] initWithFrame:(CGRectMake(60, kWidth1 + 95, 100, 10))];
        [_imageView0 addSubview:_verifiedLabel];
        
        _reviewLabel = [[UILabel alloc] initWithFrame:CGRectMake(240, 35, 130, 30)];
        [_imageView0 addSubview:_reviewLabel];
        
        _reviewStarLabel = [[UILabel alloc] initWithFrame:CGRectMake(240, 20, 130, 20)];
        [_imageView0 addSubview:_reviewStarLabel];
        
        
        
    }
    
    return self;
}



- (void)setModel:(ProfessorModel *)model {
    
    if (_model != model) {
       
        _nameLabel.text = model.user_nick;
        _locationLabel.text = model.location;
        _contactedLabel.text = [NSString stringWithFormat:@"%@ 人预约过", model.contacted_count];
        
        
        
        [_pictureView setImageWithURL:[NSURL URLWithString:model.user_face]];
        _pictureView.layer.masksToBounds = YES;
        _pictureView.layer.borderWidth = 2;
        _pictureView.layer.cornerRadius = _pictureView.bounds.size.height / 2;
        
       [_pictureView1 setImageWithURL:[NSURL URLWithString:model.pro_covers[0]]];
        [_pictureView2 setImageWithURL:[NSURL URLWithString:model.pro_covers[1]]];
        [_pictureView3 setImageWithURL:[NSURL URLWithString:model.pro_covers[2]]];
        [_pictureView4 setImageWithURL:[NSURL URLWithString:model.pro_covers[3]]];

       
        _contactedLabel.font = [UIFont systemFontOfSize:13];
        _verifiedLabel.font = [UIFont systemFontOfSize:13];
        _reviewLabel.font = [UIFont systemFontOfSize:12];
        _reviewStarLabel.font = [UIFont systemFontOfSize:13];
        
    }
    
    
}

















- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
